﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net;

namespace OnlineCooperation
{
    public partial class Test2 : System.Web.UI.Page
    {
        public List<string> list = new List<string>();
        protected void Page_Load(object sender, EventArgs e)
        {
            list.Add("item0");
            list.Add("item1");
            list.Add("item2");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

        }
        public void SendSMTPEMail(string strSmtpServer, string strFrom, string strFromPass, string strto, string strSubject, string strBody)
        {
            System.Net.Mail.SmtpClient client = new SmtpClient(strSmtpServer);
            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential(strFrom, strFromPass);
            client.DeliveryMethod = SmtpDeliveryMethod.Network;

            System.Net.Mail.MailMessage message = new MailMessage(strFrom, strto, strSubject, strBody);

            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.IsBodyHtml = true;
            client.Port = 587;
            client.EnableSsl = true;
            client.Send(message);
        }

        protected void Team_Click(object sender, EventArgs e)
        {
            //新浪邮箱
            SendSMTPEMail("smtp.gmail.com", "huangyg11@gmail.com", "zkegtomkpztvnvib", "810170713@qq.com", "CoCo", "测试一下");

            //网易126邮箱
            //SendSMTPEMail("smtp.126.com", "邮箱", "密码", "809663396@qq.com", "标题", "内容");    

        }
    }
}